var filesTreeStore = Ext.create('Ext.data.TreeStore', {
    proxy: {
        type: 'ajax',
        url: 'php/files.php'
    },
    root: {
        text: 'www',
        id: 'www',
        expanded: true
    }
});

window.appl = Ext.application({
    name: 'notepad',
    appFolder: 'ext',
    controllers: ['BaseController'],

    launch: function () {
        Ext.create('Ext.container.Viewport', {
            layout: 'border',
            items: [
                {
                    id: 'treep',
                    xtype: 'treepanel',
                    region: 'west',
                    collapsible: true,
                    resizable: true,
                    width: 200,
                    store: filesTreeStore,
                    rootVisible: true,
                    useArrows: true,
                    multiselect: true,
                    selModel: {
                        mode: 'MULTI'
                    },
                    dockedItems: [
                        {
                            xtype: 'toolbar',
                            dock: 'top',
                            items: [
                                {
                                    xtype: 'button',
                                    text: 'Созд',
                                    name: 'add'
                                }, {
                                    xtype: 'button',
                                    text: 'Переим',
                                    name: 'rename',
                                    disabled: true
                                }, {
                                    xtype: 'button',
                                    text: 'Удал',
                                    name: 'delete',
                                    disabled: true
                                }, {
                                    xtype: 'button',
                                    text: 'Обнов',
                                    name: 'reload'
                                }
                            ]
                        }
                    ]
                }, {
                    id: 'tabp',
                    xtype: 'tabpanel', // TabPanel itself has no title
                    region: 'center',
                    dockedItems: [
                        {
                            xtype: 'toolbar',
                            dock: 'top',
                            items: [
                                {
                                    xtype: 'button',
                                    text: 'Сохранить',
                                    name: 'save',
                                    disabled: true
                                }, {
                                    xtype: 'button',
                                    text: 'Откатить',
                                    name: 'reload',
                                    disabled: true
                                }
                            ]
                        }
                    ]
                }
            ]
        });
    }
});